/*
 * Powered By [rapid-framework]
 * Web Site: http://www.rapid-framework.org.cn
 * Google Code: http://code.google.com/p/rapid-framework/
 * Since 2008 - 2016
 */

package com.jzwl.site.manager.rankv2.controller;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.jzwl.common.page.PageObject;
import com.jzwl.site.manager.rankv2.service.SiteRankingV2Service;
import com.jzwl.system.base.controller.BaseController;

/**
 * SiteRankingV2
 * SiteRankingV2
 * siteRankingV2
 * <p>Title:SiteRankingV2Controller </p>
 * 	<p>Description:SiteRankingV2 </p>
 * 	<p>Company: </p> 
 * 	@author aotu-code 
 */
@Controller
@RequestMapping("/siteRankingV2")
public class SiteRankingV2Controller  extends BaseController {
	
	@Autowired
	private SiteRankingV2Service siteRankingV2Service;
	/**
	 * 跳转到添加SiteRankingV2的页面
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping(value = "/toAddSiteRankingV2")
	public ModelAndView toAddsiteRankingV2(HttpServletRequest request, HttpServletResponse response) {
		
		ModelAndView mov = new ModelAndView();
		
		createParameterMap(request);
		
		mov.setViewName("/manager/rankv2/add");
		return mov;
	}
	
	/**
	 * 添加SiteRankingV2
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping(value = "/addSiteRankingV2")
	public ModelAndView addsiteRankingV2(HttpServletRequest request, HttpServletResponse response) {
		Map<String,Object> resultMap = new HashMap<String,Object>();
		ModelAndView mov = new ModelAndView();
		
		createParameterMap(request);
		
		try{
			boolean flag = siteRankingV2Service.addSiteRankingV2(paramsMap);
			if(!flag){
				mov.addObject("msg", "添加SiteRankingV2失败!");
				mov.setViewName("/error");
			}else{
				mov.setViewName("redirect:/siteRankingV2/siteRankingV2List.html");
			}
		}catch(Exception e){
			e.printStackTrace();
			mov.addObject("msg", "添加SiteRankingV2失败!");
			mov.setViewName("/error");
		}
		
		
		return mov;
	}
	
	/**
	 * siteRankingV2list
	 */
	@RequestMapping(value = "/siteRankingV2List")
	public ModelAndView siteRankingV2List(HttpServletRequest request, HttpServletResponse response) {
	
		ModelAndView mov = new ModelAndView();
		
		createParameterMap(request);
		
		PageObject po = new PageObject();
		
		try{
		
			po = siteRankingV2Service.querySiteRankingV2List(paramsMap);
			
			mov.addObject("list", po.getDatasource());
			mov.addObject("totalProperty", po.getTotalCount());
			mov.addObject("po", po);
			mov.addObject("paramsMap", paramsMap);
			mov.setViewName("/manager/rankv2/list");
		}catch(Exception e){
		
			e.printStackTrace();
			mov.addObject("msg", "siteRankingV2查询失败");
			mov.setViewName("/error");
		}
		
		return mov;
	}
	
	
	/**
	 * 跳转到修改siteRankingV2页面
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping(value = "/toUpdateSiteRankingV2")
	public ModelAndView toUpdateSiteRankingV2(HttpServletRequest request, HttpServletResponse response) {
		
		ModelAndView mov = new ModelAndView();
		
		createParameterMap(request);
		
		try{
			Map<String,Object> siteRankingV2=siteRankingV2Service.getByRankid(paramsMap);
			mov.addObject("obj", siteRankingV2);
			mov.setViewName("/manager/rankv2/update");
		}catch(Exception e){
			e.printStackTrace();
			mov.addObject("msg", "siteRankingV2查询失败");
			mov.setViewName("/error");
		}
		
		return mov;
	}
	
	/**
	 * 跳转到详情siteRankingV2页面
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping(value = "/detailSiteRankingV2")
public ModelAndView detailSiteRankingV2(HttpServletRequest request, HttpServletResponse response) {
		
		ModelAndView mov = new ModelAndView();
		
		createParameterMap(request);
		
		try{
			Map<String,Object> siteRankingV2=siteRankingV2Service.getByRankid(paramsMap);
			mov.addObject("obj", siteRankingV2);
			mov.setViewName("/manager/rankv2/detail");
		}catch(Exception e){
			e.printStackTrace();
			mov.addObject("msg", "siteRankingV2查询失败");
			mov.setViewName("/error");
		}
		
		return mov;
	}
	/**
	 * 修改siteRankingV2
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping(value = "/updateSiteRankingV2")
	public ModelAndView updateSiteRankingV2(HttpServletRequest request, HttpServletResponse response) {
		
		ModelAndView mov = new ModelAndView(); 
		
		createParameterMap(request);
		
		try{
		
			boolean flag = siteRankingV2Service.updateSiteRankingV2(paramsMap);
			
			if(!flag){
				mov.addObject("msg", "修改失败!");
				mov.setViewName("/error");
			}else{
				mov.setViewName("redirect:/siteRankingV2/siteRankingV2List.html");
			}
		}catch(Exception e){
		
			e.printStackTrace();
			mov.addObject("msg", "修改失败!");
			mov.setViewName("/error");
		}
		
		return mov;
	}
	
	
	/**
	 * 逻辑删除siteRankingV2
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping(value = "/delSiteRankingV2")
	public ModelAndView delSiteRankingV2(HttpServletRequest request, HttpServletResponse response) {
		
		ModelAndView mov = new ModelAndView(); 
		
		createParameterMap(request);
		
		try{
		
			boolean flag = siteRankingV2Service.deleteSiteRankingV2(paramsMap);
			
			if(!flag){
				mov.addObject("msg", "删除失败!");
				mov.setViewName("/error");
			}else{
				mov.setViewName("redirect:/siteRankingV2/siteRankingV2List.html");
			}
		}catch(Exception e){
			
			e.printStackTrace();
			mov.addObject("msg", "删除失败!");
			mov.setViewName("/error");
		
		}
		
		return mov;
	}
	
	
	/**
	 * 物理删除siteRankingV2
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping(value = "/deleteSiteRankingV2")
	public ModelAndView deleteSiteRankingV2(HttpServletRequest request, HttpServletResponse response) {
		
		ModelAndView mov = new ModelAndView(); 
		
		createParameterMap(request);
		
		try{
		
			boolean flag = siteRankingV2Service.deleteSiteRankingV2(paramsMap);
			
			if(!flag){
				mov.addObject("msg", "删除失败!");
				mov.setViewName("/error");
			}else{
				mov.setViewName("redirect:/siteRankingV2/siteRankingV2List.html");
			}
		}catch(Exception e){
			
			e.printStackTrace();
			mov.addObject("msg", "删除失败!");
			mov.setViewName("/error");
		
		}
		
		return mov;
	}
	
	//auto-code-end
	
	
}

